<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../back-common.jsp"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp"%>

<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
    <%
        Long offset = (Long) request.getAttribute("offset");
    %>
    <form:form  action="${contextPath}/system/menu/queryChildMenu/${parentId}" id="form1" method="post">
        <table class="${tableclass}" style="width: 100%">
		    <thead>
		    	<tr>
			    	<th>
				    	<strong class="am-text-primary am-text-lg">权限管理</strong> /  后台${menuLevel}级菜单定义
			    	</th>
		    	</tr>
		    </thead>
		    <tbody><tr><td>
		    	     <div align="left" style="padding: 3px">
					        <input type="hidden" id="curPageNO" name="curPageNO" value="${curPageNO}" />
					        <input type="hidden" id="parentId" name="parentId" value="${parentId}" />
					            名称  
					            <input class="${inputclass}" type="text" name="name" maxlength="50" value="${menu.name}" />
					            <input class="${btnclass}" type="submit" value="搜索"/>
					            				   <c:if test="${allParentMenu !=null }">
					            				   <a href="<ls:url address='/system/menu/query'/>">菜单列表</a>&raquo; 
											    	<c:forEach items="${allParentMenu }" var="menu">
											    		<a href="<ls:url address='/system/menu/queryChildMenu/${menu.key}'/>"> ${menu.value }</a>&raquo; 
											    	</c:forEach>
											    </c:if>
					            	<input class="${btnclass}" type="button" value="创建${menuLevel}级菜单" onclick='window.location="<ls:url address='/system/menu/create/${parentId}'/>"'/>
					         </div>
		    </td></tr></tbody>
	    </table>

    </form:form>
    <div align="center">
          <%@ include file="/WEB-INF/pages/common/messages.jsp"%>
		 <display:table name="list" requestURI="/system/menu/query" id="item" export="false" sort="external" class="${tableclass}" style="width:100%">
		 	<display:column title="顺序" class="orderwidth"><%=offset++%></display:column>
     		<display:column title="名称" property="name"></display:column>
     		<display:column title="标题" property="title"></display:column>
     		<display:column title="动作" property="action"></display:column>
     		<display:column title="插件" property="providedPlugin"></display:column>
     		<display:column title="顺序" property="seq"  sortable="true" sortName="seq"></display:column>
		    <display:column title="操作" media="html"  style="width:220px">
		    	<div class="am-btn-toolbar">
				  <div class="am-btn-group am-btn-group-xs">
					<c:if test="${parentMenu == null || (parentMenu != null && parentMenu.grade < 2)}">
						<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location='${contextPath}/system/menu/queryChildMenu/${item.menuId }'"><span class="am-icon-search"></span> 子菜单</button>
					</c:if>
						<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location='${contextPath}/system/menu/load/${item.menuId}'"><span class="am-icon-pencil-square-o"></span> 修改</button>
						<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="deleteById('${item.menuId}')" ><span class="am-icon-trash-o"></span> 删除</button>
				  </div>
				</div>
		      </display:column>
	    </display:table>
        <ls:page pageSize="${pageSize }"  total="${total}" curPageNO="${curPageNO }"  type="default"/>
    </div>
        <script language="JavaScript" type="text/javascript">
			<!--
			  function deleteById(id) {
			      if(confirm("  确定删除 ?")){
			            window.location = "<ls:url address='/system/menu/delete/" + id + "'/>";
			        }
			    }
         
         highlightTableRows("item");
			//-->
		</script>

